<template>
  <div class="communityDetail">
    <!-- bannerd -->
    <div class="detail-banner">
      <img :src="imgArr[0]">
      <div class="banner-wrap">
        <img src="../../../assets/images/community/016.png">
        <p>{{imgArr.length}}</p>
      </div>
    </div>
    <!--title-->
    <div class="detail-title">
      <div class="left">
        <img class="avatar" src="../../../assets/images/community/005.png"/>
        <p class="name">{{name}}</p>
      </div>
      <div class="right"  @click="attention">{{gzValue}}</div>
      <!--<div class="right" v-if="hasgz" >已关注</div>-->
    </div>
    <!-- 内容 -->
    <div class="detail-container">
      <div class="container-title">{{title}}</div>
      <div class="container-content">{{content}}</div>
      <p class="line"></p>
      <div class="container-address">
        <img src="../../../assets/images/community/007.png"></img>
        <p>{{addressName}}</p>
      </div>
      <div class="container-tag">
        <p v-for="item in tagArr">
          <span class="tag-text">{{item}}</span>
        </p>
      </div>
      <div class="container-time">{{createTime}}</div>
    </div>
    <!-- fixed -->
    <div class="detail-fixed">
      <!-- 点赞 -->
      <div class="fixed-list" @click="onlike">
        <img  v-if="likeFlag === 0" src="../../../assets/images/community/018.png"/>
        <img  v-else="likeFlag === 1" src="../../../assets/images/community/018-active.png"/>
        <p class="num">{{likeNum}}</p>
        <p class="icon"></p>
      </div>
      <!-- 留言 -->
      <div class="fixed-list" @click="onPublishTap">
        <img src="../../../assets/images/community/019.png"/>
        <p class="num">{{replyNum}}</p>
        <p class="icon"></p>
      </div>
      <!-- 收藏 -->
      <div class="fixed-list" @click="onlove" >
        <img v-if="loveFlag === 0" src="../../../assets/images/community/020.png"/>
        <img v-else="loveFlag === 1" src="../../../assets/images/community/020-active.png"/>
        <p class="num">{{loveNum}}</p>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "communityDetail",
    data() {
      return {
        index: "",
        imgArr: [
          'https://img01.sogoucdn.com/net/a/04/link?url=http%3A%2F%2Fimg04.sogoucdn.com%2Fapp%2Fa%2F100520024%2F8a5cac4b4c8819b2b7b3014f952409be&appid=122',
          'https://img04.sogoucdn.com/net/a/04/link?url=http%3A%2F%2Fimg02.sogoucdn.com%2Fapp%2Fa%2F100520024%2Fdd6486946681d2c421b9522014c1f401&appid=122'
        ],
        title: "文化说说",
        content: "文化说说解决说说",
        addressName: '湖北省进急送镇',
        avatar: "../../../assets/images/community/005.png",
        name: "小鬼",
        tagArr: ['美丽', '健身', '增肌'],
        createTime: "2019.1.11 12:00",
        likeNum: 0,
        likeFlag: 0,
        loveNum: 0,
        loveFlag: 0,
        replyNum: 0,
        gzValue: "关注",
        messageList: [],
        tomemberid: "",
        gzFlag: true,
        hasgz: true
      }
    },
    methods: {
      attention(){
        this.gzValue='已关注'
      },
      onlike() {
        if (this.likeFlag === 0) {
          this.likeNum++;
          this.likeFlag = 1;
        }
        else {
          this.likeNum--;
          this.likeFlag = 0;
        }
      },
      onPublishTap() {
        this.$router.push('/detailWrite');
      },
      onlove(){
        if (this.loveFlag === 0) {
          this.loveNum++;
          this.loveFlag = 1;
        }
        else {
          this.loveNum--;
          this.loveFlag = 0;
        }
      },
    }
  }
</script>


<style scoped lang="less">
  .communityDetail {
    width: 100%;
    overflow: hidden;
    .detail-banner {
      width: 100%;
      height: 230px;
      overflow: hidden;
      position: relative;
      img {
        width: 100%;
        height: 100%;
      }
      .banner-wrap {
        position: absolute;
        height: 40px;
        bottom: 0;
        left: 0;
        width: 100%;
        line-height: 40px;
        background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), to(rgba(0, 0, 0, 1)));
        background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1));
        padding: 0 10px;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        color: #fff;
        font-size: 18px;
        text-align: right;
        img {
          width: 25px;
          height: 20px;
          display: inline-block;
          vertical-align: middle;
        }
        p {
          font-size: 14px;
          color: #fff;
          display: inline-block;
          vertical-align: middle;
          margin-left: 5px;
        }
      }
    }
    .detail-title {
      border-bottom: 2px solid #f5f5fa;
      width: 100%;
      text-align: left;
      height: 45px;
      padding: 0 15px;
      box-sizing: border-box;
      display: flex;
      align-items: center;
      .left {
        flex: 1;
        .avatar {
          width: 30px;
          height: 30px;
          border-radius: 50%;
          display: inline-block;
          vertical-align: middle;
        }
        .name {
          font-size: 12px;
          display: inline-block;
          vertical-align: middle;
          margin-left: 2px;
        }
      }
      .right {
        flex: 0 0 44px;
        width: 44px;
        height: 22px;
        line-height: 22px;
        color: #666;
        text-align: center;
        border-radius: 6px;
        font-size: 12px;
        border: 1px solid #c5c5c5;
      }
    }
    .detail-container {
      width: 100%;
      font-size: 12px;
      text-align: left;
      padding: 15px;
      box-sizing: border-box;
      .container-title {
        margin-bottom: 10px;
        font-weight: bold;
        color: #131313;
      }
      .container-content {
        color: #666;
        margin-bottom: 9px;
        text-align: justify;
      }
      .line {
        display: block;
        width: 100%;
        height: 1px;
        background: #e6e6e9;
        margin: 15px 0;
      }
      .container-address {
        font-size: 12px;
        width: 100%;
        img {
          width: 10px;
          height: 12px;
          display: inline-block;
          vertical-align: middle;
        }
        p {
          color: #169bd5;
          display: inline-block;
          vertical-align: middle;
          margin-left: 4px;
        }
      }
      .container-tag {
        font-size: 12px;
        margin-top: 10px;
        display: flex;
        .tag-text {
          display: inline-block;
          padding: 2px 6px;
          background: #1bbacd;
          margin-right: 10px;
          border-radius: 4px;
          color: #fff;
        }
      }
      .container-time {
        margin-top: 10px;
        font-size: 12px;
        color: #666;
      }
    }
    .detail-fixed {
      width: 100%;
      height: 42px;
      display: flex;
      bottom: 0;
      left: 0;
      padding: 0 8px;
      box-sizing: border-box;
      background: #646871;
      position: fixed;
      align-items: center;
      .fixed-list {
        flex: 1;
        text-align: center;
        position: relative;
        img {
          width: 20px;
          height: 18px;
          display: inline-block;
          vertical-align: middle;
        }
        .num {
          font-size: 12px;
          color: #fff;
          display: inline-block;
          vertical-align: middle;
          margin-left: 3px;
        }

        .icon {
          width: 1px;
          height: 15px;
          background: #8b8d91;
          position: absolute;
          right: 0;
          top: 5px;
        }
      }
      .fixed-list:nth-child(2) img {
        width: 20px;
        height: 18px;
      }

      .fixed-list:nth-child(3) img {
        width: 20px;
        height: 18px;
      }
    }
  }

  .detail-review {
    width: 100%;
    padding: 10px 6px 100px;
    box-sizing: border-box;
  }

  .review-title {
    width: 100%;
    font-size: 0;
  }

  .review-title image {
    width: 15px;
    height: 15px;
    display: inline-block;
    vertical-align: middle;
  }

  .review-title .text {
    font-size: 15px;
    color: #000;
    margin-left: 7px;
    display: inline-block;
    vertical-align: middle;
  }

  .review-title .num {
    font-size: 14px;
    color: #666;
    margin-left: 7px;
    display: inline-block;
    vertical-align: middle;
  }

  /* 评论 */
  .review-container {
    width: 100%;
  }

  .review-list {
    width: 100%;
    margin-top: 15px;
  }

  .review-info {
    display: flex;
    justify-content: space-between
  }

  .info-left {
    display: flex;
    align-items: center;
  }

  .info-avatar {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
  }

  .info-avatar image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
  }

  .info-name {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 6px;
  }

  .info-name .name {
    font-size: 10px;
    color: #000;
    margin-left: 0;
  }

  .info-name .time {
    font-size: 10px;
    color: #a9a9a9;
  }

  .info-right {
    display: flex;
    align-items: center;
  }

  .info-right image {
    width: 18px;
    height: 15px;
    flex: 0 0 18px;
  }

  .right-like {
    margin-left: 10px;
  }

  .right-like image {
    width: 15px;
    height: 14px;
  }

  .right-like text {
    font-size: 14px;
    color: #666;
    margin-left: 3px;
  }

  .review-detail {
    font-size: 12px;
    color: #666;
    margin: 12px 0;
    padding: 0 30px 0 32px;
    box-sizing: border-box;
    width: 100%;
  }

  .review-reply {
    margin: 0 30px 0 32px;
    box-sizing: border-box;
    padding: 8px 5px;
    background: #f2f2f2;
  }

  .reply-list .name {
    font-size: 12px;
    color: #169bd5;
    margin-left: 0;
  }

  .reply-list .text {
    font-size: 12px;
    color: #666;
  }


</style>
